<!DOCTYPE html>
<html>
<head>
	<meta id="view" name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
	<meta charset="utf-8">
</head>
<body>
	<h1>viewport测试</h1>
	<p id="p1"></p>
	<p id="p2"></p>
	<p id="p3"></p>
	<input type="button" id="btn" value="111" />
	<script>
	function $(id){
		return document.getElementById(id);
	}
	$('btn').onclick = function(){
		var scale = 1/window.devicePixelRatio;
		var view = $('view');
		view.setAttribute('content','width=device-width, initial-scale=' + scale+', maximum-scale=1.0, user-scalable=0');
		render();
	}
	function render(){
		$('p1').innerHTML = '设备像素比：' + window.devicePixelRatio;
		$('p2').innerHTML = '设备宽度：' + document.documentElement.clientWidth;
		$('p3').innerHTML = $('view').getAttribute('content');
	}
	render();
	</script>
</body>
</html>